/**
 * Created by liubin on 2015/09/17.
 */
'use strict'

import { combineReducers, createStore, applyMiddleware} from 'redux';
import {authorization} from '../reducers/authReducer';
import { userStore } from '../reducers/userReducer';
import { roleStore } from '../reducers/roleReducer';
//import { reducer as form } from 'redux-form';
import form from 'reducers/formReducer';
import thunkMiddleware from 'redux-thunk';
import authMiddleware from '../tools/authMiddleware';
import bluebirdPromiseMiddleware from '../tools/bluebirdPromiseMiddleware';

/**
 * 加载中间件
 * 异步action处理
 */
const createStoreWithMiddleware = applyMiddleware(
    bluebirdPromiseMiddleware,
    thunkMiddleware
    //authMiddleware
)(createStore);
const app = combineReducers({authorization, userStore, roleStore, form});
const store = createStoreWithMiddleware(app);
export default store;